package com.jr.controller;

import com.google.gson.Gson;
import com.jr.entity.Province;
import com.jr.service.ProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Summer
 * @email 2838259857@qq.com
 * @date 2023-01-12-20:30
 */
@Controller
public class ProvinceController {
    @Autowired
    private ProvinceService provinceService;
    /**
     * 获取省份列表
     */
    @RequestMapping(value = "getprovinces.do", produces = "text/html;charset=utf-8")
    public @ResponseBody String getprovinces(){
        List<Province> provinces = provinceService.getProvinces();
        return new Gson().toJson(provinces);
    }



}



